#******************************************************************
#
# Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
# Plugin Interface build script
##

import os.path

Import('env')

target_os = env.get('TARGET_OS')

#####################################################################
# Source files and Target(s)
######################################################################

env.AppendUnique(CPPPATH=[
    '#/plugins/include',
    '#/plugins/include/internal',
    '#/resource/oc_logger/include',
    '#/resource/csdk/include',
    '#/resource/csdk/stack/include',
    '#/resource/csdk/logger/include',
    '#/resource/c_common/oic_string/include',
    '#/plugins/zigbee_wrapper/telegesis_wrapper/include',
])

if target_os not in ['windows']:
    env.AppendUnique(CPPDEFINES=['WITH_POSIX'])

if target_os in ['darwin', 'ios']:
    env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])

tw_src = [
    'twsocketlist.c',
    'telegesis_socket.c',
    'telegesis_wrapper.c',
]

env.AppendUnique(TW_SRC=tw_src)

if target_os in ['android', 'tizen']:
    calib = env.SharedLibrary('telegesis_wrapper', env.get('TW_SRC'))
else:
    calib = env.StaticLibrary('telegesis_wrapper', env.get('TW_SRC'))
env.InstallTarget(calib, 'libtelegesis_wrapper')
env.UserInstallTargetLib(calib, 'libtelegesis_wrapper')
